import { createApp } from 'vue';
import { createPinia } from 'pinia';
import router from './router';
import App from './App.vue';
import './style.css';
import './assets/styles/global.css';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import '@fortawesome/fontawesome-free/css/all.css';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import en from 'element-plus/es/locale/lang/en';
import i18n from './i18n';

const pinia = createPinia();
const app = createApp(App);

// 根据当前语言设置 Element Plus 的语言
const elementLocale = i18n.global.locale.value === 'zh-CN' ? zhCn : en;

app.use(pinia);
app.use(router);
app.use(ElementPlus, {
  locale: elementLocale,
});
app.use(i18n);
app.mount('#app');